GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Conversation

Notices

  1. Embed this notice
    Alex Gleason (alex@gleasonator.com)'s status on Monday, 09-Jan-2023 07:49:25 JST Alex Gleason Alex Gleason

    Linux people, gimme a hand. I want this to crash if the inner command crashes. Currently it writes the error out(?) to the file:

    echo "EXTRA_DESCRIPTION=$(npx ts-node ./scripts/changelog.ts $CI_COMMIT_TAG)" >> variables.env

    If npx ts-node ./scripts/changelog.ts $CI_COMMIT_TAG crashes, I want it to exit 1.

    In the happy case, variables.env is a text file which contains EXTRA_DESCRIPTION="result of command"

    This is in my CI. How?

    In conversation Monday, 09-Jan-2023 07:49:25 JST from gleasonator.com permalink

    Attachments


    • Embed this notice
      djsumdog (djsumdog@djsumdog.com)'s status on Monday, 09-Jan-2023 07:54:03 JST djsumdog djsumdog
      in reply to
      `set -e` ?

      Alternatively, don't run the `npx` command within a `$()`. Run it by itself and immediately check the `$?` exit code after
      In conversation Monday, 09-Jan-2023 07:54:03 JST permalink
      Alex Gleason likes this.
    • Embed this notice
      Corné Dorrestijn (corne@cd0.nl)'s status on Monday, 09-Jan-2023 07:54:18 JST Corné Dorrestijn Corné Dorrestijn
      in reply to

      You could store the result in a var first:

      result="EXTRA_DESCRIPTION=$(npx ts-node ./scripts/changelog.ts $CI_COMMIT_TAG)" && echo $result >> variables.env
      In conversation Monday, 09-Jan-2023 07:54:18 JST permalink
      Alex Gleason likes this.
    • Embed this notice
      Alex Gleason (alex@gleasonator.com)'s status on Monday, 09-Jan-2023 08:03:14 JST Alex Gleason Alex Gleason
      in reply to
      • djsumdog

      @djsumdog I think what I’m trying to do might be impossible anyway. I can’t put the contents of a Markdown file into a bash variable and preserve whitespace.

      GitLab CI wants me to do that in order to automate releases.

      In conversation Monday, 09-Jan-2023 08:03:14 JST permalink
    • Embed this notice
       (mint@ryona.agency)'s status on Monday, 09-Jan-2023 08:05:37 JST  
      in reply to
      • djsumdog
      @alex @djsumdog Perniaesque solution: encode Markdown in base64 and decode it when needed.
      In conversation Monday, 09-Jan-2023 08:05:37 JST permalink
      Alex Gleason likes this.
    • Embed this notice
      Alex Gleason (alex@gleasonator.com)'s status on Monday, 09-Jan-2023 08:05:54 JST Alex Gleason Alex Gleason
      in reply to
      • 
      • djsumdog

      @mint @djsumdog I hate that, but it might just work.

      I also found this: https://stackoverflow.com/a/47700062

      In conversation Monday, 09-Jan-2023 08:05:54 JST permalink

      Attachments


    • Embed this notice
      Alex Gleason (alex@gleasonator.com)'s status on Monday, 09-Jan-2023 08:07:22 JST Alex Gleason Alex Gleason
      in reply to
      • d
      • djsumdog

      @deprecated_ii @djsumdog Yeah. result=$(cat CHANGELOG.md) && echo $result strips all the newlines.

      In conversation Monday, 09-Jan-2023 08:07:22 JST permalink

      Attachments

      1. Domain not in remote thumbnail source whitelist: ik.imagekit.io
        Changelog
        Announce updates and news to your users with Changelog.md
    • Embed this notice
      d (deprecated_ii@poa.st)'s status on Monday, 09-Jan-2023 08:07:23 JST d d
      in reply to
      • djsumdog
      @alex @djsumdog why can't you preserve whitespace? it's just symbols in the text, are those symbols being stripped by something?
      In conversation Monday, 09-Jan-2023 08:07:23 JST permalink
    • Embed this notice
      Alex Gleason (alex@gleasonator.com)'s status on Monday, 09-Jan-2023 08:08:29 JST Alex Gleason Alex Gleason
      in reply to
      • d
      • djsumdog

      @deprecated_ii @djsumdog What I’m actually trying to do is this: https://gitlab.com/soapbox-pub/soapbox/-/merge_requests/2051/diffs

      Halfway works. This is good advice here, I think I can figure something out. The base64 idea is just retarded enough to work.

      In conversation Monday, 09-Jan-2023 08:08:29 JST permalink

      Attachments


    • Embed this notice
      kallusti (kallisti@refusal.llc)'s status on Monday, 09-Jan-2023 08:12:47 JST kallusti kallusti
      in reply to
      @alex subshells spawn their own process.

      echo "EXTRA_DESCRIPTION=$(npx ts-node ./scripts/changelog.ts $CI_COMMIT_TAG || kill -9 $$)" >> variables.env

      if the command inside fails, it runs the command kill -9 to the parent PID. $() spawns a subshell, so $$ is that shell process. kill -9 instant kills the process
      In conversation Monday, 09-Jan-2023 08:12:47 JST permalink
      Alex Gleason likes this.
    • Embed this notice
      翠星石 (suiseiseki@freesoftwareextremist.com)'s status on Monday, 09-Jan-2023 17:56:17 JST 翠星石 翠星石
      in reply to
      @alex >Linux people, gimme a hand.
      >Asks questions about GNU bash only
      In conversation Monday, 09-Jan-2023 17:56:17 JST permalink

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.