Tweet Automatically-ish, Now with Go

Iteration and efficiecy at work

This is a brief update to share that I switched out the shell version for a golang version. This change made the tweeting mechanism smarter while reducing the container size to 1/5th of what it was.

Due to the way arguments are passed in and the selected workflow and file names, the job definition for this repository that triggers the tweets has to be adjusted.

The changes to meep-meep were done in MR 1.

After merging into the meep-meep/master branch, adding the git tag v2.0 triggered the build and tag.

Now the pipeline definition is a bit different.

image: registry.gitlab.com/pages/hugo:latest

variables:
  GIT_SUBMODULE_STRATEGY: recursive

stages:
  - build
  - review
  - deploy
  - tweet

test:
  stage: build
  script:
    - hugo
  only:
    - branches
  except:
    - master

pages:
  stage: build
  script:
    - hugo
  artifacts:
    paths:
      - public
  only:
    - master

review:
  image: alpine
  stage: review
  script:
    - echo "${CI_COMMIT_MESSAGE}" > tweet.txt
    - echo "${BLOG_URL_STUB}${CI_MERGE_REQUEST_CHANGED_PAGE_PATHS}" >> tweet.txt
  only:
    - branches
  except:
    - master
  environment:
    name: local
    url: http://127.0.0.1:1313
  artifacts:
    expose_as: 'Tweet preview'
    paths: ['tweet.txt']
  variables:
    GIT_STRATEGY: none

tweet:
  stage: tweet
  image: registry.gitlab.com/brownfield-dev/public/meep-meep:v2-0
  script:
    - meep -path tweet.txt
  only:
    - branches
  except:
    - master
  when: manual
  environment:
    name: twitter
    url: 'https://twitter.com/Brownfield_dev?x=#'
  dependencies:
    - review
  variables:
    GIT_STRATEGY: none

And the variables are now named more specifically for twitter:

TWITTER_ACCESS_TOKEN
TWITTER_ACCESS_TOKEN_SECRET
TWITTER_CONSUMER_KEY
TWITTER_CONSUMER_SECRET
BLOG_URL_STUB

Some tweets

gitlab  ci